home *** CD-ROM | disk | FTP | other *** search
Wrap
/* ** $VER: MotionBlur.rexx 2.01, IE Arexx script ** Image Engineer Macro script ** Copyright © by Patrik M Nydensten ** 16/1 1997 Stockholm/Sweden ** ** Creates a motion blur effect on image. ** Based on the MotionBlur.ieb 1.02 and requires rexxmathlib.library. ** ** Support for saving last used results added by MS */ Options Results Signal On Error if arg()==0 then exit /* Get info from user */ if exists("ie:prefs/vemotionblur.cfg") == "1" then do call open("temp","ie:prefs/vemotionblur.cfg","R") values=readln("temp") parse var values ok method MixVal Angle Length Step Direc . call close("temp") end else do method=0 mixval=20 angle=0 length=32 step=2 direc=0 end 'FORM "Motion Blur" "Ok|Cancel"', ' TEXT,"Motion Blur creates a `sweeping` blur effect."', ' CYCLE,"Method:","Mix (blurring)|Max (brighten)|Min (darken)",'method'', ' INTEGER,"Mix sharpness (Mix method only)",0,100,'mixval',SLIDER', ' INTEGER,"Angle:",0,359,'angle',SLIDER', ' INTEGER,"Length:",1,256,'length',SLIDER', ' INTEGER,"Step:",1,32,'step',SLIDER', ' CHECKBOX,"Blur both edges",'direc'' values=result parse var values ok Method MixVal Angle Length Step Direc . if ok = 0 then exit call open("temp","ie:prefs/vemotionblur.cfg","W") res=writeln("temp",values) call close("temp") if ok = 0 then exit if Method == 0 then Method = "MIX" if Method == 1 then Method = "MAX" if Method == 2 then Method = "MIN" /* Process image */ if add_mathlib() = '<ERROR>' then exit 'PROJECT_INFO' arg(1) 'WIDTH' IW = RESULT 'PROJECT_INFO' arg(1) 'HEIGHT' IH = RESULT 'SCALE' arg(1) IW IH 'FAST' LoadImage = Result do until ((Angle < 360)&(Angle >= 0)) if Angle > 359 then Angle = Angle - 360 if Angle < 0 then Angle = Angle + 360 end if Method == 'MIX' then Method = 'MIX' MixVal Angle = 6.2831853 * Angle /360 if Direc == 0 then do /* Single */ 'SCALE' LoadImage IW IH 'FAST' BackImage = Result do i = 1 to Length by Step 'MARK' LoadImage 'PRIMARY' 'MARK' BackImage 'SECONDARY' 'COMPOSITE' (Length-i)*cos(Angle) (i-Length)*sin(Angle) Method TempImage = Result 'CLOSE' BackImage BackImage = TempImage end 'CLOSE' LoadImage OutputImage = BackImage end else do /* Both */ do i = 1 to Length by Step 'MARK' LoadImage 'PRIMARY' 'MARK' LoadImage 'SECONDARY' 'COMPOSITE' (Length-i)*cos(Angle) (i-Length)*sin(Angle) Method TempImage = Result 'CLOSE' LoadImage LoadImage = TempImage end OutputImage = LoadImage end back = 'OK' exit /* Internal procedures ---------------------------------------------- */ add_mathlib: if ~show(L,'rexxmathlib.library') then do if exists('LIBS:rexxmathlib.library') then do if ~addlib('rexxmathlib.library',0,-30,0) then do 'REQUEST' '"Failed to load libs:rexxmathlib.library!"' '" OK "' return '<ERROR>' end end /* lib found on disk */ else do 'REQUEST' '"Failed to find libs:rexxmathlib.library!"' '" OK "' return '<ERROR>' end end /* lib exists in mem */ return 'OK' /*******************************************************************/ /* This is where control goes when an error code is returned by IE */ /* It puts up a message saying what happened and on which line */ /*******************************************************************/ error: if RC=5 then do IE_TO_FRONT LAST_ERROR 'REQUEST "'||RESULT||'"' end else do IE_TO_FRONT LAST_ERROR 'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' ' OK ' end return '<ERROR>'